﻿using Common.DTO;
using Database.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GameLogic
{
    public class IslandQueManager
    {
        private readonly IslandRepository _islandRepository;
        private readonly IslandQueRepository _islandQueRepository;
        private readonly CharacterRepository _characterRepository;

        public IslandQueManager()
        {
            _islandRepository = new IslandRepository();
            _islandQueRepository = new IslandQueRepository();
            _characterRepository = new CharacterRepository();
        }

        public Guid AddCharacterToQue(Guid islandId, Guid characterId)
        {
            var island = _islandRepository.Read(islandId);
            var character = _characterRepository.Read(characterId);

            //if (island.IslandQues == null)
            //    island.IslandQues = new List<IslandQueDTO>();

            var islandQue = new IslandQueDTO
            {
                Character = character,
                Island = island
            };
            //island.IslandQues.Add(islandQue);

            var islandQueId = _islandQueRepository.Create(islandQue);

            return islandQueId;
        }
    }
}
